home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / sndhrdw / aztarac.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  957b  |  55 lines

  1. /*
  2.  * Aztarac soundboard interface emulation
  3.  *
  4.  * Jul 25 1999 by Mathis Rosenhauer
  5.  *
  6.  */
  7.  
  8. #include "driver.h"
  9. #include "cpu/z80/z80.h"
  10.  
  11. static int sound_command, sound_status;
  12.  
  13. READ_HANDLER( aztarac_sound_r )
  14. {
  15.     if (Machine->sample_rate)
  16.         return sound_status & 0x01;
  17.     else
  18.         return 1;
  19. }
  20.  
  21. WRITE_HANDLER( aztarac_sound_w )
  22. {
  23.     sound_command = data;
  24.     sound_status ^= 0x21;
  25.     if (sound_status & 0x20)
  26.         cpu_cause_interrupt( 1, Z80_IRQ_INT );
  27. }
  28.  
  29. READ_HANDLER( aztarac_snd_command_r )
  30. {
  31.     sound_status |= 0x01;
  32.     sound_status &= ~0x20;
  33.     return sound_command;
  34. }
  35.  
  36. READ_HANDLER( aztarac_snd_status_r )
  37. {
  38.     return sound_status & ~0x01;
  39. }
  40.  
  41. WRITE_HANDLER( aztarac_snd_status_w )
  42. {
  43.     sound_status &= ~0x10;
  44. }
  45.  
  46. int aztarac_snd_timed_irq (void)
  47. {
  48.     sound_status ^= 0x10;
  49.  
  50.     if (sound_status & 0x10)
  51.         return Z80_IRQ_INT;
  52.     else
  53.         return Z80_IGNORE_INT;
  54. }
  55.